$(function () {
    $("#menu").accordion({
        classes: {
            "ui-accordion": "highlight"
        },
        heightStyle: "content"
    });
    menuActive()

});

function menuActive() {
    var pathname = window.location.pathname;
    var patArr = pathname.trim().split("/")
    // $( "#menu" ).accordion({ active: 2 });
    if (patArr[1] == 'index') {
        $("#menu").accordion({active: 0});
    } else if (patArr[1] == 'student') {
        $("#menu").accordion({active: 1});
    } else if (patArr[1] == 'teacher') {
        $("#menu").accordion({active: 2});
    } else if (patArr[1] == 'score') {
        $("#menu").accordion({active: 3});
    } else if (patArr[1] == 'census') {
        $("#menu").accordion({active: 4});
    } else if (patArr[1] == 'enrol' || patArr[1] == 'classes') {
        $("#menu").accordion({active: 5});
    } else if (patArr[1] == 'user') {
        $("#menu").accordion({active: 6});
    } else if (patArr[1] == 'system') {
        $("#menu").accordion({active: 7});
    }
    console.log(patArr);
}

function date() {
    setInterval(function () {
        var date = new Date();
        var year = date.getFullYear();    //获取当前年份
        var mon = date.getMonth() + 1;      //获取当前月份
        var da = date.getDate();          //获取当前日
        var day = date.getDay();          //获取当前星期几
        var h = date.getHours();          //获取小时
        var m = date.getMinutes();        //获取分钟
        var s = date.getSeconds();        //获取秒
        var d = document.getElementById('date');
        var weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
        d.innerHTML = year + '年' + mon + '月' + da + '日' + weekday[day] + ' ' + h + ':' + m + ':' + s;
    }, 1000);
}

